﻿using System;
using System.Collections.Generic;
using System.Text;

namespace SimpleSalesTrackingAPIWrapper
{
    public class Sales
    {
        // Get list of all Sales
        public static List<SimpleSalesTrackingAPI.Sale> GetSales(string username, string password)
        {
            SimpleSalesTrackingAPI.API api = new SimpleSalesTrackingAPI.API();
            return new List<SimpleSalesTrackingAPI.Sale>(api.GetSales(username, password));
        }

        // Get list of all Sales Accounts
        public static List<SimpleSalesTrackingAPI.Sale> GetSalesAccounts(string username, string password)
        {
            SimpleSalesTrackingAPI.API api = new SimpleSalesTrackingAPI.API();
            return new List<SimpleSalesTrackingAPI.Sale>(api.GetSalesAccounts(username, password));
        }

        // Get list of all Sales Opportunities
        public static List<SimpleSalesTrackingAPI.Sale> GetSalesOpportunities(string username, string password)
        {
            SimpleSalesTrackingAPI.API api = new SimpleSalesTrackingAPI.API();
            return new List<SimpleSalesTrackingAPI.Sale>(api.GetSalesOpportunities(username, password));
        }

        // Get list of all Sales Leads
        public static List<SimpleSalesTrackingAPI.Sale> GetSalesLeads(string username, string password)
        {
            SimpleSalesTrackingAPI.API api = new SimpleSalesTrackingAPI.API();
            return new List<SimpleSalesTrackingAPI.Sale>(api.GetSalesLeads(username, password));
        }

        // Get list of all Sales Leads
        public static List<SimpleSalesTrackingAPI.SaleSimple> GetSalesSimpleNotClosed(string username, string password)
        {
            SimpleSalesTrackingAPI.API api = new SimpleSalesTrackingAPI.API();
            return new List<SimpleSalesTrackingAPI.SaleSimple>(api.GetSalesSimpleNotClosed(username, password));
        }

        // Get a single Sale, by SaleId
        public static SimpleSalesTrackingAPI.Sale GetSaleById(string username, string password, int saleId)
        {
            SimpleSalesTrackingAPI.API api = new SimpleSalesTrackingAPI.API();
            return api.GetSaleById(username, password, saleId);
        }

        // Get a single StageId by saleId
        public static int GetSaleStageById(string username, string password, int saleId)
        {
            SimpleSalesTrackingAPI.API api = new SimpleSalesTrackingAPI.API();
            return api.GetSaleStageById(username, password, saleId);
        }

        // Insert a new Sale
        public static int InsertSale(string username, string password, SimpleSalesTrackingAPI.Sale sale)
        {
            SimpleSalesTrackingAPI.API api = new SimpleSalesTrackingAPI.API();
            return api.InsertSale(username, password, sale);
        }

        // Insert a new Sale
        public static int InsertSale(string username, string password, int stageId, string name, string description, DateTime startDate, DateTime endDate,
            DateTime expectedCloseDate, DateTime followUpDate, decimal amountLow, decimal amountHigh, decimal amountActual,
            int statusId, int scaleId, string leadSource, string website)
        {
            SimpleSalesTrackingAPI.API api = new SimpleSalesTrackingAPI.API();

            return api.InsertSale2(username, password, stageId, name, description, startDate, endDate,
            expectedCloseDate, followUpDate, amountLow, amountHigh, amountActual,
            statusId, scaleId, leadSource, website);
        }

        public static int InsertSale(string username, string password, int stageId, string name, int statusId, int scaleId)
        {
            SimpleSalesTrackingAPI.API api = new SimpleSalesTrackingAPI.API();
            return api.InsertSale3(username, password, stageId, name, statusId, scaleId);
        }

        // Update an existing Sale
        public static int UpdateSale(string username, string password, SimpleSalesTrackingAPI.Sale sale)
        {
            SimpleSalesTrackingAPI.API api = new SimpleSalesTrackingAPI.API();
            return api.UpdateSale(username, password, sale);
        }

        // Update an existing Sale
        public static int UpdateSale(string username, string password, int saleId, string name, string description, DateTime startDate, DateTime endDate,
            DateTime expectedCloseDate, DateTime followUpDate, decimal amountLow, decimal amountHigh, decimal amountActual,
            int statusId, int scaleId, string leadSource, string website)
        {
            SimpleSalesTrackingAPI.API api = new SimpleSalesTrackingAPI.API();

            return api.UpdateSale2(username, password, saleId, name, description, startDate, endDate,
            expectedCloseDate, followUpDate, amountLow, amountHigh, amountActual,
            statusId, scaleId, leadSource, website);
        }

        public static int UpdateStage(string username, string password, int saleId, int stageId)
        {
            SimpleSalesTrackingAPI.API api = new SimpleSalesTrackingAPI.API();
            return api.UpdateStage(username, password, saleId, stageId);
        }

        // Delete an existing Sale
        public static int DeleteSale(string username, string password, SimpleSalesTrackingAPI.Sale sale)
        {
            SimpleSalesTrackingAPI.API api = new SimpleSalesTrackingAPI.API();
            return api.DeleteSale(username, password, sale);
        }

        // Delete an existing Sale
        public static int DeleteSale(string username, string password, int saleId)
        {
            SimpleSalesTrackingAPI.API api = new SimpleSalesTrackingAPI.API();
            return api.DeleteSale2(username, password, saleId);
        }

    }
}
